import React from 'react';
import {TouchableOpacity, StyleSheet, View, Text} from 'react-native'
import Icon from '$/components/Icon';

export default class ViewUtil {


    /**
     * 获取左侧返回按钮
     * @param callBack
     * @returns {XML}
     */
    static backButton(color,callBack=()=>{}) {
        if(typeof color === 'function'){
            callBack = color;
            color = null;
        }
        return <TouchableOpacity
            style={{
                padding: 8,
                paddingLeft: 12,
                paddingRight: 30,
                borderBottomEndRadius: 25,
                borderTopEndRadius: 25
            }}
            onPress={callBack}>
            <Icon  size={26}
                   style={{color:color || '#fff'}}
            >&#xe631;</Icon>
        </TouchableOpacity>
    }

    /**
     * 设置通用图标按钮
     * @param Component | callBack
     * @returns {XML}
     */
    static setButton(Icon, callBack) {
        return <TouchableOpacity
            style={{padding: 8, paddingLeft: 12}}
            onPress={callBack}>
            {Icon}
        </TouchableOpacity>
    }
    /**
     * 获取右侧文字按钮
     * @param title
     * @param callBack
     * @returns {XML}
     */
    static rightButton(title, callBack) {
        return <TouchableOpacity
            style={{alignItems: 'center',}}
            onPress={callBack}>
            <Text style={{fontSize: 20, color: '#FFFFFF', marginRight: 10}}>{title}</Text>
        </TouchableOpacity>
    }


}
const styles = StyleSheet.create({
    setting_item_container: {
        backgroundColor: 'white',
        padding: 10, height: 60,
        alignItems: 'center',
        justifyContent: 'space-between',
        flexDirection: 'row'
    },
});
